#ifndef LIBRARY_LIBVIEW_H_
#define LIBRARY_LIBVIEW_H_

#include <QWidget>
#include <QProgressBar>
#include <QSlider>
#include <vector>

#include "Library.h"
#include "ReaderWriter.h"

class LibView : public QWidget {
    Q_OBJECT

    static const int MAX_WORKERS = 50;
    static const int MAX_RW_INTERVAL = 3000;
    static const int MAX_BOOKS = 1000;
public:
    explicit LibView(QWidget *parent = 0);
    
signals:
    
public slots:
    void setWaitCount(int waitCount);

private slots:
    void updateNumberOfReaders(int newValue);
    void updateNumberOfWriters(int newValue);

private:

    void updateWorkers(QVector<Worker*> &workers,
                       int newValuem,
                       Worker* (*repptr)(Library&));

    void initComponents();
    void initConnections();

    QVector<Worker*> readersVec;
    QVector<Worker*> writersVec;

    QProgressBar* numberOfBooksPB;
    QProgressBar* readersWritersPB;
    QProgressBar* _pendingCount;

    QSlider* readIntervalSlider;
    QSlider* writeIntervalSlider;
    QSlider* booksSlider;
    QSlider* readersSlider;
    QSlider* writersSlider;

    Library library;
};

#endif // LIBRARY_LIBVIEW_H_
